package untiring07.swing.outline;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.OceanTheme;

import ch.randelshofer.quaqua.QuaquaManager;
import javax.swing.JMenuBar;
import javax.swing.JButton;
import javax.swing.JToolBar;
import javax.swing.JMenu;

// 스윙 프로그램 모양과 느낌 변경
// javax.swing.UIManager 클래스의
// setLookAndFeel 메서드를 사용
// com.sun.java.swing.plaf.gtk.GTKLookAndFeel
// javax.swing.plaf.metal.MetalLookAndFeel
// com.sun.java.swing.plaf.windows.WindowsLookAndFeel
// com.sun.java.swing.plaf.motif.MotifLookAndFeel
// com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel


// JFrame.setDefaultLookAndFeelDecorated(true);
// UIManager.setLookAndFeel( 룩앤필명칭 );

//MacOSX와 비슷한 lookandfeel을 제공하는 사이트
// www.randelshoger.ch/quaqua/

public class J06_HelloSwingLookAndFeel extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		System.setProperty("Quaqua.tabLayoutPolicy", "wrap");
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JFrame.setDefaultLookAndFeelDecorated(true);
					UIManager.setLookAndFeel(QuaquaManager.getLookAndFeel());
					J06_HelloSwingLookAndFeel frame = new J06_HelloSwingLookAndFeel();
					
					//UIManager.setLookAndFeel(
					//	"javax.swing.plaf.metal.MetalLookAndFeel");
					// Look And Feel 지정
					// MetalLookAndFeel.setCurrentTheme(new OceanTheme());
					
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public J06_HelloSwingLookAndFeel() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		menuBar.setToolTipText("File(F)");
		setJMenuBar(menuBar);
		
		JMenu mnFilef = new JMenu("File(F)");
		menuBar.add(mnFilef);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JToolBar toolBar = new JToolBar(); //툴바생성
		toolBar.setFloatable(false); // 툴바이동방지
		//toolBar.setFocusable(false); // 클릭시 테두리 제거
		
		contentPane.add(toolBar, BorderLayout.NORTH);
		
		// 툴바 클릭시 이벤트 처리를 담당할 클래스 등록
		J07_HelloSwingActionListener action = new J07_HelloSwingActionListener();
		
		// 툴바에 추가할 버튼 생성
		JButton btnNewButton = new JButton("New button");
		btnNewButton.setFocusPainted(false);
		btnNewButton.addActionListener(action); //이벤트처리
		btnNewButton.setActionCommand("new");
		toolBar.add(btnNewButton);  // 툴바에 추가
		
		JButton btnNewButton_1 = new JButton("New button");
		btnNewButton_1.setFocusPainted(false);
		toolBar.add(btnNewButton_1);
		
		JButton btnNewButton_2 = new JButton("New button");
		toolBar.add(btnNewButton_2);
	}

}
